

<%@ page import="edu.auctionmart.Auction" %>
<!doctype html>
<html>
    <head>
        <meta name="layout" content="mobile">
        <g:set var="entityName" value="${message(code: 'auction.label', default: 'Auction')}" />
        <title>Create a new Auction</title>
    </head>
    <body>
    	<div data-role="header" data-position="fixed">
			<h1>Create Auction</h1>
			<div data-role="navbar">
				<ul>
					<li><a data-icon="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
					<li><g:link data-icon="grid" data-ajax="false" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
				</ul>
			</div>
		</div>
		<div data-role="content">
			<g:if test="${flash.message}">
			<div class="message" role="alert">${flash.message}</div>
			</g:if>
			<g:hasErrors bean="${auctionInstance}">
			<div class="errors" role="alert">
				<g:renderErrors bean="${auctionInstance}" as="list" />
			</div>
			</g:hasErrors>
			
			<g:form action="save" >
			
				<div data-role="fieldcontain">
					<label for="auctionTitle"><g:message code="auction.auctionTitle.label" default="Auction Title" /></label>
					<g:textField name="auctionTitle" value="${auctionInstance?.auctionTitle}" />
				</div>
				
				<div data-role="fieldcontain">
					<label for="endTime"><g:message code="auction.endTime.label" default="End Time" /></label>	
					<joda:dateTimePicker name="endTime" id="endTime" required="" value="${auctionInstance.endTime}" />
				</div>
				
				<div data-role="fieldcontain">
					<label for="startBid"><g:message code="auction.startBid.label" default="Start Bid" /></label>
					<g:field type="number" name="startBid" value="${fieldValue(bean: auctionInstance, field: 'startBid')}" />
				</div>
				
				<div data-role="fieldcontain">
					<label for="hiddenMinBid"><g:message code="auction.hiddenMinBid.label" default="Hidden Min Bid" /></label>
					<g:field type="number" name="hiddenMinBid" value="${fieldValue(bean: auctionInstance, field: 'hiddenMinBid')}" />
				</div>
				
				<div data-role="fieldcontain">
					<label for="name"><g:message code="auction.item.label" default="Item Name" /></label>
					<g:textField name="name" id="name" required="" value="${auctionInstance?.name}" />
				</div>
				
				<div data-role="fieldcontain">
					<label for="description"><g:message code="auction.item.label" default="Description" /></label>
					<g:textArea name="description"id="description" value="${auctionInstance?.description}" />
				</div>
				
				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'category', 'error')} required">
					<label for="category"> 
						Category: 
						<span class="required-indicator">*</span>
					</label>
					<g:select name="category"
						from="${edu.auctionmart.ItemCategory?.values()}"
						keys="${edu.auctionmart.ItemCategory.values()*.name()}"
						required="" value="${auctionInstance?.category?.name()}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'isbn', 'error')} ">
					<label for="isbn">
						ISBN:
					</label>
					<g:textField name="isbn" id="isbn" value="${auctionInstance?.isbn}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'weight', 'error')} ">
					<label for="weight">
						Weight: 
					</label>
					<g:field type="number" name="weight" id="weight" value="${fieldValue(bean: auctionInstance, field: 'weight')}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'dimension', 'error')} ">
					<label for="dimension"> 
						Dimension:
					</label>
					<g:textField name="dimension" id="dimension" value="${auctionInstance?.dimension}" />
				</div>

				<div class="fieldcontain ${hasErrors(bean: auctionInstance, field: 'quantity', 'error')} required">
					<label for="quantity"> 
						Quantity: 
						<span class="required-indicator">*</span>
					</label>
					<g:field type="number" id="quantity" name="quantity" min="1" required="" value="${fieldValue(bean: auctionInstance, field: 'quantity')}" />
				</div>

				<g:submitButton name="create" data-icon="check" value="${message(code: 'default.button.create.label', default: 'Create')}" />
			</g:form>
		</div>
		<div data-role="footer">
		</div>
    </body>
</html>
